#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<assert.h>

#define FILE_NAME "test.txt"

//#define ONE 0x1
//#define TWO 0x2
//#define THREE 0x4
//#define FOUR 0x8
//两种表示方法，都是取32个比特位的每一位的1开始 one 就是第一位 two就是第二位，00000010也就是2
//three也就是第三位 00000100 也就是4，four就是第四位00001000 就是8
#define ONE (1 << 0)
#define TWO (1 << 1)
#define THREE (1 << 2)
#define FOUR (1 << 3)

void show(int flags)
{
    if(flags & ONE) printf("one\n");
    if(flags & TWO) printf("two\n");
    if(flags & THREE) printf("three\n");
    if(flags & FOUR) printf("four\n");
}

void show_test()
{
    show(ONE);
    printf("-----------------------\n");
    show(TWO);
    printf("-----------------------\n");
    show(THREE);
    printf("-----------------------\n");
    show(FOUR);
    printf("-----------------------\n");
    show(ONE | TWO);
    printf("-----------------------\n");
    show(ONE | TWO | THREE);
    printf("-----------------------\n");
    show(ONE | TWO | THREE | FOUR);
    printf("-----------------------\n");
}

int main()
{
    umask(0);
    int fd = open(FILE_NAME,O_WRONLY | O_CREAT,0666);
    //assert(fd != -1);
    //(void)fd;
    if(fd < 0){
        perror("fd");
        return 1;
    }
    return 0;
}
